#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

std::string get_file_dir_linux(const std::string& path) {
    // 找到最后一个路径分隔符的位置
    size_t last_slash_pos = path.rfind('/');
        if (last_slash_pos != std::string::npos) {
        //std::cout << "The substring '" << toFind << "' was last found at position: " << pos << std::endl;
        return path.substr(0,last_slash_pos);
    } else {
        return path;
    }
}